package com.jsb.laundry.model.vo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jsb.laundry.common.utils.JSBUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 订单详情
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class LaundryOrderDetailVo implements Serializable {

    /**
     * 支付流水ID
     */
    private String orderId;
    /**
     * 订单状态
     */
    private String orderStatus;

    /**
     * 实付款总金额
     */
    private String actualPay;
    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payTime;

    /**
     * 预约上门时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String appointmentTimeStr;

    public void setAppointmentTimeStr(String appointmentTimeStr) {
        if (JSBUtil.isEmptyObject(appointmentTimeStr)) {
            this.appointmentTimeStr = "--";
        } else {
            this.appointmentTimeStr = appointmentTimeStr;
        }
    }

    /**
     * 骑手接单时间
     */
//    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String orderReceivingTime;

    public void setOrderReceivingTime(String orderReceivingTime) {
        if (JSBUtil.isEmptyObject(orderReceivingTime)) {
            this.orderReceivingTime = "——";
        } else {
            this.orderReceivingTime = orderReceivingTime;
        }
    }

    // 收货信息
    private InnerUserInfo userInfo;
    // 骑手信息
    private List<InnerRiderInfo> riderInfo;

    // 订单中商品列表
    private List<InnerOrderInfo> orderInfoList;


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class InnerUserInfo {
        /**
         * 详细地址
         */
        private String userDetailAddress;
        /**
         * 骑手姓名
         */
        private String userName;
        /**
         * 骑手性别(0男，1女)
         */
        private String userSex;
        /**
         * 骑手电话
         */
        private String userPhone;
    }

    /**
     * 骑手信息
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class InnerRiderInfo {
        /**
         * 骑手ID
         */
        private String riderId;
        /**
         * 骑手姓名
         */
        private String idName;
        /**
         * 骑手电话
         */
        private String riderPhone;
    }


    /**
     * 购买的商品
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class InnerOrderInfo {
        /**
         * 订单ID
         */
        private String orderId;
        private String productId;
        /**
         * 衣物图片
         */
        private String goodsImg;

        /**
         * 衣物名称
         */
        private String goodsName;
        /**
         * 购买量
         */
        private int buyNum;
        /**
         * 原价
         */
        private String servePrice;

        /**
         * 单笔商品订单的实际付款
         */
        private int total;
        /**
         * 分类ID
         */
        private String cateId;
        /**
         * 分类名
         */
        private String cateName;
        /**
         * 服务ID
         */
        private String serveId;
        /**
         * 服务分类名
         */
        private String serveMsg;
    }

}





